/*
 * Copyright 2010 Electronic Business Systems Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package gr.ebs.gssdroid.widget;


import gr.ebs.gssdroid.R;
import android.app.Dialog;
import android.content.Context;
import android.text.util.Linkify;
import android.view.Display;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.TextView;

public class InfoDialog extends Dialog {
	public TextView textAboutContent;
	
	public InfoDialog(Context context, int titleResourceId, int textContentResourceId){
		super(context);
		setContentView(R.layout.dialoginfo);
		setTitle(titleResourceId);
		LayoutParams paramsDialog = getWindow().getAttributes();
		WindowManager wm =(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
		Display display = wm.getDefaultDisplay();
		paramsDialog.width = (int)((double)display.getWidth()*0.9);
		
		textAboutContent = (TextView)findViewById(R.id.infoDialogTextContent);
		textAboutContent.setText(textContentResourceId);
		Linkify.addLinks(textAboutContent, Linkify.WEB_URLS);
		
		
	}
	
	public InfoDialog(Context context, int titleResourceId, String textContentResourceId){
		super(context);
		setContentView(R.layout.dialoginfo);
		setTitle(titleResourceId);
		LayoutParams paramsDialog = getWindow().getAttributes();
		WindowManager wm =(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
		Display display = wm.getDefaultDisplay();
		paramsDialog.width = (int)((double)display.getWidth()*0.9);
		
		textAboutContent = (TextView)findViewById(R.id.infoDialogTextContent);
		textAboutContent.setText(textContentResourceId);
		Linkify.addLinks(textAboutContent, Linkify.WEB_URLS);
		
		
	}
	
	
	//@Override
	public void onBackPressed() {
		this.dismiss();
		//super.onBackPressed();
	}

}
